path = r"C:\Users\YGK\Desktop\file2.txt"
f = open(path, "a")

#写文件
#1、将信息写入缓冲区
f.write("sunck is a good man")

#2、刷新缓冲区
#直接把内部缓冲区的数据立刻写入文件,而不是被动的等待自动刷新缓冲区写入
f.flush()

f.close()


#简写方式
with open(path,"a") as f2:
    f2.write("good man")